package net.lab1024.sa.base.module.support.yuntuip.controller;

import net.lab1024.sa.base.common.domain.ValidateList;

import net.lab1024.sa.base.module.support.yuntuip.domain.form.YuntuIpAddForm;
import net.lab1024.sa.base.module.support.yuntuip.domain.form.YuntuIpQueryForm;
import net.lab1024.sa.base.module.support.yuntuip.domain.form.YuntuIpUpdateForm;
import net.lab1024.sa.base.module.support.yuntuip.domain.vo.YuntuIpVO;
import net.lab1024.sa.base.module.support.yuntuip.service.YuntuIpService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * chenyuqiang Controller
 *
 * @Author chenyuqiang
 * @Date 2025-09-16 22:46:18
 * @Copyright 1
 */

@RestController
@Tag(name = "chenyuqiang")
public class YuntuIpController {

    @Resource
    private YuntuIpService yuntuIpService;

    @Operation(summary = "分页查询 @author chenyuqiang")
    @PostMapping("/yuntuIp/queryPage")
    @SaCheckPermission("yuntuIp:query")
    public ResponseDTO<PageResult<YuntuIpVO>> queryPage(@RequestBody @Valid YuntuIpQueryForm queryForm) {
        return ResponseDTO.ok(yuntuIpService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author chenyuqiang")
    @PostMapping("/yuntuIp/add")
    @SaCheckPermission("yuntuIp:add")
    public ResponseDTO<String> add(@RequestBody @Valid YuntuIpAddForm addForm) {
        return yuntuIpService.add(addForm);
    }

    @Operation(summary = "更新 @author chenyuqiang")
    @PostMapping("/yuntuIp/update")
    @SaCheckPermission("yuntuIp:update")
    public ResponseDTO<String> update(@RequestBody @Valid YuntuIpUpdateForm updateForm) {
        return yuntuIpService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author chenyuqiang")
    @PostMapping("/yuntuIp/batchDelete")
    @SaCheckPermission("yuntuIp:delete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Integer> idList) {
        return yuntuIpService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author chenyuqiang")
    @GetMapping("/yuntuIp/delete/{id}")
    @SaCheckPermission("yuntuIp:delete")
    public ResponseDTO<String> batchDelete(@PathVariable Integer id) {
        return yuntuIpService.delete(id);
    }
}
